package com.yupi.yupicturebackend.model.enums;


import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 标签分类等级枚举
 */
@Getter
public enum TagCategoryLevelEnum {

    Tag("标签", 1),
    Category("分类", 1);

    private final String text;

    private final int value;


    TagCategoryLevelEnum(String text, int value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据 value 获取枚举
     */
    public static TagCategoryLevelEnum getEnumByValue(Integer value) {
        if (ObjUtil.isEmpty(value)) {
            return null;
        }
        for (TagCategoryLevelEnum anEnum : TagCategoryLevelEnum.values()) {
            if (anEnum.value == value) {
                return anEnum;
            }
        }
        return null;
    }
}
